package
{
	//import Crap.wav;
	
	import HorribleSquawk.wav;
	
	import flash.display.MovieClip;
	import flash.events.Event;
	
	public class bird extends MovieClip
	{
		var myPoop:bullet = new bullet();
		var mySquawk:wav = new wav();
		public var shitSpeed:int;
		public var vx:int;
		
		public function bird()
		{
			super();
			shitSpeed=50;
			vx=10;
			myPoop.vy=-10;
			this.addEventListener(Event.ENTER_FRAME, updater)
				//does the cleanup
		}
		public function poop()
		{
			if(myPoop.stage){}
			else
			{
				myPoop.x = this.x;
				myPoop.y = this.y;
				//Fartknocker
				stage.addChild(myPoop);
			}
		}
		public function updater(e:Event):void
		{
			moveBird();
			checkPoop();
		}
		
		public function checkPoop():void
		{
			var myVar:int = int(Math.random()*shitSpeed);
			if (myVar == 1)
			{
				this.poop();
			}
			if(myPoop.y > stage.stageHeight && myPoop.stage){
			stage.removeChild(myPoop);
			}
		}
		
		public function moveBird():void
		{
			this.x-=vx;
			if(this.x <= -20)
			{
				this.x=stage.stageWidth;
			}
			
		}
		
		
	}
}